import 'package:flutter/material.dart';
import 'package:instagram_flutter_clone/insta_stories.dart';

class InstagList extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    return ListView.builder(
      itemBuilder: (context, index){
        if(index == 0) {
          return InstagStories();
        }
        return Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.all(16.0),
              child: Row(
                children: <Widget>[
                  CircleAvatar(
                    backgroundImage: NetworkImage("https://randomuser.me/api/portraits/women/34.jpg"),
                  ),
                  SizedBox(width: 10,),
                  Expanded(
                    child: Text("imthpk",style: TextStyle(fontWeight: FontWeight.bold),),
                  ),
                  Icon(Icons.more_vert,color: Colors.grey,)
                ],
              ),
            ),
            Container(
              height: 300,
              child: ListView.builder(
                itemCount: index,
                semanticChildCount: 2,
                scrollDirection: Axis.horizontal,
                itemBuilder: (context, index2){
                  return Image.network("https://randomuser.me/api/portraits/women/72.jpg", width: size.width,height: 300,fit: BoxFit.fill);
                },
              ),
            ),
            Container(
              padding: const EdgeInsets.all(10),
              child: Row(
                children: <Widget>[
                  Icon(Icons.favorite_border),
                  SizedBox(width: 10,),
                  Icon(Icons.chat_bubble_outline),
                  SizedBox(width: 10,),
                  Icon(Icons.send),
                  Expanded(child: Container(),),
                  Icon(Icons.tab)
                ],
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              padding: const EdgeInsets.symmetric(horizontal: 16),
              child: Text("Like by pawankumar,pk and 231234,67 other", style: TextStyle(fontWeight: FontWeight.bold)),
            ),
            Container(
              padding: const EdgeInsets.only(top: 16,left: 16, right: 16),
              child: Row(
                children: <Widget>[
                  CircleAvatar(
                    backgroundImage: NetworkImage("https://randomuser.me/api/portraits/women/2.jpg"),
                  ),
                  SizedBox(width: 10,),
                  Expanded(
                    child:TextField(
                      decoration: InputDecoration(
                        border: InputBorder.none,
                        hintText: "Add a comment ..."
                      ),
                  )
                  ),
                ],
              ),
            ),
            
            Container(
              padding: const EdgeInsets.all(16),
              child: Text("1 year ago", style: TextStyle(color: Colors.grey),),
            )
          ],
        );
      },
      itemCount: 5,
    );
  }
}